package com.j283_5.wisdom_park.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.j283_5.wisdom_park.mapper.LoginMapper;
import com.j283_5.wisdom_park.pojo.Login;
import com.j283_5.wisdom_park.service.LoginService;
import com.j283_5.wisdom_park.vo.login_information.LoginInformationVo;
import com.j283_5.wisdom_park.vo.login_management.LoginVo;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * <p>
 * 登录表 服务实现类
 * </p>
 *
 * @author laoda
 * @since 2022-04-28
 */
@Service
public class LoginServiceImpl extends ServiceImpl<LoginMapper, Login> implements LoginService {
    @Resource
    private LoginMapper loginMapper;

    @Override
    public Map<String, Object> loginselect(LoginVo loginVo) {
        Map<String,Object> map = new HashMap();
        List<LoginVo> loginVoList = loginMapper.select(loginVo);
        if (loginVoList!=null){
            map.put("code",200);
            map.put("msg","查询成功！");
            map.put("data",loginVoList);
        }else {
            map.put("code",201);
            map.put("msg","查询失败！");
        }


        return map;
    }

    @Override
    public LoginInformationVo selectLoginInformation(String userName) {
        return loginMapper.selectLoginInformation(userName);
    }

    @Override
    public boolean queryLoginInformation(String userName, String password) {
        return loginMapper.queryLoginInformation(userName,password) != null;
    }
}
